from requests import post
from generator import get_single_data

def generate_signature(data, secret):
    """生成请求签名"""
    timestamp = str(int(time.time()))
    sign_str = timestamp + secret + data.decode()
    return hashlib.sha256(sign_str.encode()).hexdigest()

post("http://localhost:5000/api/v1/sensor", json={"sensor_data": get_single_data(scene, season, user_id)})